﻿using System;
using System.Collections.Generic;
using System.Text;

namespace CanSWAT
{
    class CanSWAT
    {
        public static string CAN_SWAT_TITLE = "CanSWAT";

        public static void showInformationWindow(string msg)
        {
            System.Windows.Forms.MessageBox.Show(msg, CAN_SWAT_TITLE);
        }

        public static void debugInformation(string msg)
        {
            System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + ", Information : " + msg);
        }

        /// <summary>
        /// The CanSWAT interface installation folder
        /// </summary>
        public static string InstallationFolder
        {
            get
            {
                return System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\";
            }
        }

        public static void Run(string relativePath, string parameters = "")
        {
            string path = InstallationFolder + relativePath;
            if (!System.IO.File.Exists(path))
            {
                showInformationWindow(path + " doesn't exist. Please re-install CanSWAT interface.");
                return;
            }

            System.Diagnostics.Process.Start(path, parameters);
            
        }

    }
}
